﻿using System;
using System.Xml.Serialization;

namespace Kwik.Orm
{
	/// <summary>
	/// Schema column
	/// </summary>
	public sealed class Column : ISchemaColumn
	{
		/// <summary>
		/// Create a new column object
		/// </summary>
		public Column() { }
		/// <summary>
		/// Create a new column object with the supplied name
		/// </summary>
		/// <param name="name">Column name</param>
		public Column(string name) { this.Name = name; }


		/// <summary>
		/// Colum name
		/// </summary>
		[XmlAttribute]
		public string Name { get; set; }
		/// <summary>
		/// Column description
		/// </summary>
		[XmlAttribute]
		public string Description { get; set; }
		/// <summary>
		/// Column ordinal position
		/// </summary>
		[XmlAttribute]
		public int Ordinal { get; set; }
		/// <summary>
		/// Column data size
		/// </summary>
		[XmlAttribute]
		public int Size { get; set; }
		/// <summary>
		/// Column numeric scale
		/// </summary>
		[XmlAttribute]
		public int Scale { get; set; }
		/// <summary>
		/// Column numeric precision
		/// </summary>
		[XmlAttribute]
		public int Precision { get; set; }
		/// <summary>
		/// Column data type
		/// </summary>
		[XmlAttribute]
		public string Type { get; set; }
		/// <summary>
		/// Indication whether this column is a key
		/// </summary>
		[XmlAttribute]
		public bool IsKey { get; set; }
		/// <summary>
		/// Indication whether this column can be null
		/// </summary>
		[XmlAttribute]
		public bool IsNullable { get; set; }
		/// <summary>
		/// Indication whether this column is contains an auto generated value
		/// </summary>
		[XmlAttribute]
		public bool IsAutoIncrement { get; set; }
		/// <summary>
		/// Indication whether this column value is unique
		/// </summary>
		[XmlAttribute]
		public bool IsUnique { get; set; }
		/// <summary>
		/// The default value for this column
		/// </summary>
		[XmlAttribute]
		public string DefaultValue { get; set; }
	}
}
